# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=pwned
pkgver=2887.e081143
pkgrel=1
pkgdesc="A command-line tool for querying the 'Have I been pwned?' service."
groups=('blackarch' 'blackarch-recon')
arch=('any')
url='https://github.com/wKovacs64/pwned'
license=('MIT')
depends=('nodejs')
makedepends=('git' 'npm')
source=("git+https://github.com/wKovacs64/$pkgname.git")
sha512sums=('SKIP')

pkgver(){
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  _npmdir="$pkgdir/usr/lib/node_modules/"

  install -dm 755 $_npmdir

  cd $_npmdir

  npm install --user root -g --prefix "$pkgdir/usr" pwned@
  rm -rf "$_npmdir/root"

  cd "$srcdir/pwned"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" *.md
  install -Dm 644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

